using System;
using System.Collections;
using System.Collections.Generic;

namespace NanoERP.Model
{
    /// <summary>
    /// 系统数据字典
    /// </summary>
    [Serializable]
    public sealed class Sysdictable
    {
        #region Private Members

        // Variabili di stato
        private bool _isChanged;

        // Properties 
        private int _id;
        private string _diccode;
        private string _dicname;
        private string _value;
        private string _description;
        private int _parent;
        private int _state;

        #endregion

        #region Default ( Empty ) Class Constructor

        /// <summary>
        /// default constructor
        /// </summary>
        public Sysdictable()
        {
            _id = 0;
            _diccode = null;
            _dicname = null;
            _value = null;
            _description = null;
            _parent = 0;
            _state = 0;
        }

        #endregion // End of Default ( Empty ) Class Constructor

        #region Full Constructor

        /// <summary>
        /// full constructor
        /// </summary>
        public Sysdictable(int dickey, string diccode, string dicname, string value, string description, int parent, int state)
        {
            _id = dickey;
            _diccode = diccode;
            _dicname = dicname;
            _value = value;
            _description = description;
            _parent = parent;
            _state = state;
        }

        #endregion // End Full Constructor

        #region Public Properties

        /// <summary>
        /// 
        /// </summary>		
        public int Id
        {
            get { return _id; }
            set { _isChanged |= (_id != value); _id = value; }
        }

        /// <summary>
        /// 字典编码
        /// </summary>		
        public string Diccode
        {
            get { return _diccode; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Diccode", value, value.ToString());

                _isChanged |= (_diccode != value); _diccode = value;
            }
        }

        /// <summary>
        /// 字典名称
        /// </summary>		
        public string Dicname
        {
            get { return _dicname; }
            set
            {
                if (value != null)
                    if (value.Length > 200)
                        throw new ArgumentOutOfRangeException("Invalid value for Dicname", value, value.ToString());

                _isChanged |= (_dicname != value); _dicname = value;
            }
        }

        /// <summary>
        /// 字典值
        /// </summary>		
        public string Value
        {
            get { return _value; }
            set
            {
                if (value != null)
                    if (value.Length > 255)
                        throw new ArgumentOutOfRangeException("Invalid value for Value", value, value.ToString());

                _isChanged |= (_value != value); _value = value;
            }
        }

        /// <summary>
        /// 描述
        /// </summary>		
        public string Description
        {
            get { return _description; }
            set
            {
                if (value != null)
                    if (value.Length > 512)
                        throw new ArgumentOutOfRangeException("Invalid value for Description", value, value.ToString());

                _isChanged |= (_description != value); _description = value;
            }
        }

        /// <summary>
        /// 父节点
        /// </summary>		
        public int Parent
        {
            get { return _parent; }
            set { _isChanged |= (_parent != value); _parent = value; }
        }

        /// <summary>
        /// 0-封存；1-再用
        /// </summary>		
        public int State
        {
            get { return _state; }
            set { _isChanged |= (_state != value); _state = value; }
        }

        #endregion

    }
}